<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>菜单按钮</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        body {
            background-image: linear-gradient(45deg, #E91E63, #9C27B0, #673AB7);
            height: 100vh;
        }
        
        #menu {
            position: relative;
            cursor: pointer;
            float: right;
            margin: 30px;
            padding-top: 8px;
            padding-left: 7px;
            padding-right: 7px;
            height: 36px;
            width: 30px;
            border-radius: 50%;
            transition: all 1s;
            z-index: 99;
        }
        
        #menu:hover {
            background-color: #f40;
        }
        
        #menu>span {
            display: block;
            width: 30px;
            height: 2px;
            background-color: #fff;
        }
        
        .close-menu>span {
            margin: 6px 0;
            transition: transform 1s;
        }
        
        .open-menu {
            position: relative;
            background: rgb(0, 0, 0, .2);
        }
        
        .open-menu>span {
            transition: transform 1s;
        }
        
        .open-menu>span:first-child {
            transform: rotate(45deg);
            position: absolute;
            top: 50%;
        }
        
        .open-menu>span:last-child {
            opacity: 0;
        }
        
        .open-menu>span:nth-child(2) {
            transform: rotate(-45deg);
            position: absolute;
            top: 50%;
        }
        /* 下拉菜单 */
        
        #menu-bar {
            position: fixed;
            width: 100%;
            height: 110px;
            top: -110px;
            background-color: rgb(0, 0, 0, .2);
            transition: all 1s;
        }
        
        #menu-bar ul {
            list-style: none;
        }
        
        #menu-bar>ul {
            width: 800px;
            margin: 0 auto;
        }
        
        #menu-bar>ul::after {
            content: '';
            display: block;
            clear: both;
        }
        
        #menu-bar>ul>li {
            margin: 0 100px;
            font-weight: lighter;
            font-size: 16px;
            color: #fff;
            line-height: 110px;
            float: left;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div class="close-menu" id="menu">
        <span></span>
        <span></span>
        <span></span>
    </div>

    <div id="menu-bar">
        <ul>
            <li>页面内容</li>
            <li>组件</li>
            <li>工具类</li>
        </ul>
    </div>

    <script>
        $(function() {
            $flag = true;
            $('#menu').click(function() {
                if ($flag) {
                    $(this).attr('class', 'open-menu');
                    $('#menu-bar').css('top', '0');
                    $flag = false;
                } else {
                    $(this).attr('class', 'close-menu');
                    $('#menu-bar').css('top', '-110px');
                    $flag = true;
                }
            })
        })
    </script>

</body>

</html>